/**
 * @ClassName LC2293
 * @Author ykx
 * @Date 2024/7/3 20:00
 * @Version 1.0
 */
public class LC2293 {
    public static void main(String[] args) {
        LC2293 lc2293 = new LC2293();
        System.out.println(lc2293.minMaxGame(new int[]{70, 38, 21, 22}));
    }

    public int minMaxGame(int[] nums) {
        int n = nums.length;
        if (n == 1) {
            return nums[0];
        } else {
            int[] newNums = new int[n / 2];
            for (int i = 0; i < newNums.length; i++) {
                if (i % 2 == 0) {
                    newNums[i] = Math.min(nums[2 * i], nums[2 * i + 1]);
                } else {
                    newNums[i] = Math.max(nums[2 * i], nums[2 * i + 1]);
                }
            }
            return minMaxGame(newNums);
        }
    }

}
